package com.cndym.dao.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.cndym.dao.IFillByYYDao;
import com.cndym.utils.hibernate.PageBean;

/**
 * @author faxc
 * @date 2013-7-22 下午05:12:01
 */
@Repository
public class FillByYYDaoImpl implements IFillByYYDao {

	@Resource
	private JdbcTemplate jdbcTemplate;

	
	
//	public Limit getLimitBySID(String sid) {
//		String sql = "select*from user_Limit where sid=? for update";
//
//		return jdbcTemplate.queryForObject(sql,
//				new BeanPropertyRowMapper<Limit>(Limit.class),
//				new Object[] { sid });
//
//	}


	public Object getTBySQL(String sql, Class c) {

		try {

			return jdbcTemplate.queryForObject(sql,
					new BeanPropertyRowMapper(c));
		} catch (Exception e) {
			return null;
		}

	}

	@Override
	public List getListWithTypeBySQL(String sql, Object[] param, Class c) {
		return jdbcTemplate.query(sql, new BeanPropertyRowMapper(c), param);
	}

	@Override
	public void updateBySQL(String sql) {
		jdbcTemplate.execute(sql);
	}

	@Override
	public void updateBySQL(String sql, String[] param) {
		jdbcTemplate.update(sql, param);
	}

	@Override
	public int updateBySQLWithResuInt(String sql, Object[] param) {
		return jdbcTemplate.update(sql, param);
	}

	@Override
	public List getListBySQL(String sql, Object[] param) {

		return jdbcTemplate.queryForList(sql, param);

	}

	@Override
	public boolean isOneByTradeId(Object o, String tradeId, String sid,
			String platform) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean save(Object o) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean saveAllObject(List l) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public PageBean getPageBean(String select, Object[] paramValues,
			int pageId, int pageSize) {
		// TODO Auto-generated method stub
		return null;
	}


	@Override
	public void update(Object o) {
		
	}


	@Override
	public List getListBySQL(String sql) {
		return jdbcTemplate.queryForList(sql);
	}
}
